#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os, os.path, sys
import time

from cellstore import CellStore, KeyNotFoundError,KeyExistError

import log

class   Cell(object) :
    '''
    A Cell is bound of CellStore + CellCache
    '''

    def __init__(self, store_path) :
        if not os.path.exists(store_path) :
            os.makedirs(store_path)

        self._store = CellStore(store_path)
        # __init__()

    def __del__(self) :
        if self._store :
            del self._store
        # __del__()

    def insert(self, key, data, timeout=0) :
        return self._store.insert(key, data, timeout)
        # insert()

    def erase(self, key) :
        return self._store.erase(key)
        # erase()

    def lookup(self, key) :
        '''
        return (data,expiration)
        '''
        return self._store.lookup(key)
        # lookup()

    # class Cell
